<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:74:"/www/wwwroot/xs.cyu0.com/public/../application/index/view/login/login.html";i:1706772698;}*/ ?>
<link href="/assets/css/frontend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo htmlentities(\think\Config::get('site.version')); ?>" rel="stylesheet">
<link rel="stylesheet" href="/pc/layui/css/layui.css">
<script src="/pc/js/jquery.min.js"></script>
<script src="/pc/layui/layui.js"></script>
<style>
body{padding:0;}	
</style>
<div class="login-main" style="padding:25px 25px 0;">
	<div  id="login-form" class="form-vertical">
		<!--@IndexLoginFormBegin-->
		<?php echo token(); ?>
		<div class="form-group">
			<label class="control-label" for="account"><?php echo __('Account'); ?></label>
			<div class="controls">
				<input class="form-control" id="account" type="text" name="account" value="" data-rule="required"
					placeholder="<?php echo __('Email/Mobile/Username'); ?>" autocomplete="off">
				<div class="help-block"></div>
			</div>
		</div>
		<div class="form-group">
			<label class="control-label" for="password"><?php echo __('Password'); ?></label>
			<div class="controls">
				<input class="form-control" id="password" type="password" name="password" data-rule="required;password"
					placeholder="<?php echo __('Password'); ?>" autocomplete="off">
			</div>
		</div>
		<div class="form-group">
			<div class="controls">
				<div class="checkbox inline">
					<label>
						<input type="checkbox" name="keeplogin" checked="checked" value="1"> <?php echo __('Keep login'); ?>
					</label>
				</div>
				<div class="pull-right"><a href="javascript:;" class="btn-forgot"><?php echo __('Forgot password'); ?></a></div>
			</div>
		</div>
		<div class="form-group">
			<button type="button" onclick="submit()" class="btn btn-primary btn-lg btn-block"><?php echo __('Sign in'); ?></button>
			<a class="btn btn-default btn-lg btn-block mt-3 no-border" href="javascript:void(0);" onclick="go_register()"><?php echo __("Don't have an account? Sign up"); ?></a>
		</div>
		<!--@IndexLoginFormEnd-->
		<div>
		    <a class="btn btn-success btn-block mb-2" href="<?php echo addon_url('/wxfollowlogin/index/index'); ?>"><i class="fa fa-wechat"></i> 公众号二维码</a>
		</div>
	</form>
</div>
<script>
	var layer;
	layui.use(function() {
		layer = layui.layer;
	});
	function go_register(){
		parent.window.show_register();
		//layer.closeAll();
	}
	function submit(){
		
		$.ajax({
		    type:"POST",
		    url:"/api.php/login/login",
		    dataType:"json",
		    data:{
		        "account":$('#account').val().trim(),
		        "password":$('#password').val().trim(),
				"keeplogin":$('input[name="keeplogin"]').is(':checked'),
		        "__token__":$('input[name="__token__"]').val().trim(),
		    },
		    success:function(res){
		        console.log(res);
		        if(res.code==0){
		            layer.msg(res.msg,{icon:5});
		            $('input[name="__token__"]').val(res.data.token);
		        }else{
		            layer.msg(res.msg,{icon:6},function(){
		                layer.closeAll();
						parent.window.location.href="<?php echo url('user/index'); ?>";
		            });
		        }
		    }
		});
	} 
</script>